package com.xsz.repository;

import com.xsz.entity.Position;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

public interface PositionRepository extends JpaRepository<Position,String> {

    public List< Position> findByName(String name);//根据职业名称查找
    public List< Position> findByCompanyName(String companyName);//根据公司名称查找
    public List< Position> findByMinSalaryGreaterThanEqualAndMaxSalaryLessThanEqual(Integer mixSalary, Integer maxSalary);//根据薪资查找
    public List< Position> findByAddress(String address);//根据办公地点查找
    //默认使用JPQL，操作的是对象，所以里面的列名字必须和entity的属性名字一样
    @Query("select s from Position s where s.minSalary<?1 and s.maxSalary>?1")
    public List< Position> getPositionBySalary(Integer salary);

    public List<Position> findByNameLike(String name);

    List<Position> findByCreateBy(String createById);


}
